﻿@using Library
@model Ecommerce.Models.EditSpecificationValueViewModel

<li class="list-group-item@(Model.Id <= 0 ? " list-group-item-success" : "")" id="sv-@Model.Id">
    @using (Ajax.BeginForm("EditSpecificationValue", "Admin",
        new AjaxOptions
        {
            HttpMethod = "POST",
            AllowCache = false,
            UpdateTargetId = "sv-" + Model.Id,
            InsertionMode = InsertionMode.ReplaceWith,
            OnSuccess = "updateSorting"
        }, new { @id = "sv-form-" + Model.Id, @class = "form-inline" }))
    {
        @Html.AntiForgeryToken()
        @Html.HiddenFor(m => m.SpecificationId)
        if (Model.Id > 0)
        {
            @Html.HiddenFor(m => m.Id)
            <div class="form-group">
                <span class="glyphicon glyphicon-move"></span>
            </div>
        }
        <div class="form-group">
            <label class="sr-only">@NOWCulture.GetString("Weight value")</label>
            @Html.TextBoxFor(m => m.Weight, new { @class = "form-control", @type = "number", @min = "0", @placeholder = NOWCulture.GetString("Weight value"), @style = "width: 100px" })
        </div>
        <div class="form-group">
            <label class="sr-only">@NOWCulture.GetString("Specification value")</label>
            @Html.TextBoxFor(m => m.Value, new { @class = "form-control", @autofocus = "", @placeholder = NOWCulture.GetString("Specification value"), @style = "width: 580px" })
        </div>
        <button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-floppy-disk"></i></button>
        <button type="button" class="btn btn-danger" data-id="@Model.Id"><i class="glyphicon glyphicon-remove"></i></button>
        <button type="button" class="btn btn-success" data-specificationid="@Model.SpecificationId"><i class="glyphicon glyphicon-plus"></i></button>
        @Html.ValidationMessageFor(m => m.Value, "", new { @class = "text-danger" })
        @Html.ValidationMessageFor(m => m.Weight, "", new { @class = "text-danger" })
        @Html.ValidationSummary(true, "", new { @class = "bg-danger" })
    }
</li>
